<template>
	<view>
		<view class="all">
			<!-- 输入框头部图标 -->
			<uni-easyinput prefixIcon="person" v-model="user.username" placeholder="请输入账号" @iconClick="onClick"></uni-easyinput>
			<!-- 展示输入框尾部图标 -->
			<uni-easyinput prefixIcon="info-filled" type="password" v-model="user.password" placeholder="请输入密码"></uni-easyinput>
			<uni-easyinput prefixIcon="info-filled"  v-model="user.nickname" placeholder="请输入昵称"></uni-easyinput>
			<button class="mini-btn cli_c" style="margin-top: 50rpx;width: 300rpx;height: 80rpx;font-size: 35rpx;"  @click="register()" type="primary" size="mini">注册</button>
			{{this.tip}}
		</view>
	</view>
</template>

<script>
import bill from '../../api/pay.js';
export default {
	data() {
		return {
			tip:'',
			user: {
				nickname:'',
				username: '',
				password: ''
			}
		};
	},
	methods: {
		register() {
			bill.regsiter(this.user).then(res => {
					console.log(res.data.data.msg)
					if (res.data.data.msg == "ok") {
						// 注册了让他去登录
						uni.redirectTo({
							url: '/pages/login/login'
						});
					}
					else{
						this.tip="请先填写完账号密码"
					}
			});
		}
	}
};
</script>

<style scoped lang="less">
.all {
	margin: 50rpx;
	padding: 20rpx;
	display: flex;
	flex-direction: column;
	align-items: center;
}
</style>
